# -*- coding: utf-8 -*-

from typing import List, Tuple
from .type import EventCenter, EventEngine
from contract_market.base.event import Event


class EventEngineMeta:
    """ """

    def __init__(
        self,
        event_center: EventCenter,
        event_engine: "EventEngine"
    ) -> None:
        """ """
        self.event_center: EventCenter = event_center
        self.event_engine: "EventEngine" = event_engine

    def stop(self): ...
    def start(self): ...


class EventSystemEngineStructure(EventEngineMeta):
    """ 
    ::param _fields
    ---
    Explain:
        _fields : [(event_type, event)]
    """
    _fields: List[Tuple] = []

    def __init__(self, event_center: EventCenter, event_engine: "EventEngine") -> None:
        """ """
        super().__init__(event_center, event_engine)
        if len(self._fields) < 0:
            return

        for event_type, event in self._fields:
            event = Event(event_type, event)
            self.event_engine.on_event(event)

